home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- Neuromancer Software
-
-
- Presents
-
-
- ┌───────────────────────────────────────┐
- │ mtGraph Mode13h Graphics Toolkit 1.0c │
- └───────────────────────────────────────┘
-
- Release Date : 6th August 1994
-
-
-
-
-
-
-
- Copyright 1994 Tay Choon Heong
-
- Draft : 28th June 1994
-
- Revised : 6th August 1994
-
-
-
-
- ┌────────────┬───────────────────────────────────────────────┐
- │ Disclaimer │ │
- └────────────┴───────────────────────────────────────────────┘
-
- As with standard disclaimer, this product is provided on an
- "as-is" basis, and the author makes no warranty or
- representation, express or implied, with respect to its quality
- performance or fitness for a particular purpose. In no event will
- the author of this document be liable for direct, indirect,
- special, incidental, or consequential damages arising out of the
- use or inability to use the information contained within.
-
- This beta version is hereby released "AS IT IS" to the interested
- users and no warranty will be provided. Use of this product is
- at your own risk.
-
- However, if you have got any queries or bugs report, you are most
- welcome to contact me at the following address :
-
-
- Address : Tay Choon Heong
- Blk 201, Toa Payoh North
- #02-1063,
- Singapore 1231
-
- Tel : 2 5 0 8 6 5 8
-
- email : chtay@iti.gov.sg
-
-
- ┌─────────┬──────────────────────────────────────────────────┐
- │ Preface │ │
- └─────────┴──────────────────────────────────────────────────┘
-
-
- It all started out with XLIB and YAKICONS.
-
- I have always wanted to develop my own game, me being an addict
- to the fantastic computer animation commercials I have seen on
- TV. After reading the newsgroup in the internet, I came to know
- of the several graphical libraries which are very useful for this
- purpose. WGT, SPX, XLIB, YAKICONS and VGL20 immediately spring
- to mind. However, as I realised later, some of these packages are
- shareware. Being a student, I was unable to fork out the money
- to register the package so I was left with the latter three
- packages.
-
- Although they are not shareware packages, XLIB,YAKICONS and
- VGL20 are excellent packages with full source codes provided.
- XLIB is developed around Mode X with Yakicons being a class
- library built on XLIB. VGL20 on the other hand supports mode13h.
- They provided me with the development toolkits which are more
- than adequate to satisfy my needs. As a standard routine
- pertaining to my starting a project, I started to read up on
- Mode X and it was brought to my attention that Mode X involved
- tweaking with some VGA registers. I read somewhere that it was
- "dangerous" to tweak the VGA registers and I began to worry if
- it is safe to use it.
-
- So, I was quite depressed at that time .. until someone (I
- believe it was Joshua Hightower..) pointed me to some excellent
- documents written by Grant Smith. That started me on the idea of
- developing my own library. I began to source for information on
- this subject; assembly language tutorials, Game Developer's
- Magazine, PC Game Programming Encyclopedia, VGL20 etc. All these
- have been a great help to me and my thanks to the authors!
- However, one person had been most helpful to me and has been
- helping me since I started. Here, I would like to take this
- chance to thank Goran Devic for his support! The result is this
- graphical library that you have in your possession.
-
-
- Finally, I would like to thank you for your interest in the
- mtGraph mode 13h graphical toolkit library.
-
-
-
-
- Yours sincerely
-
- Tay Choon Heong
-
- 5th July 1994
-
-
-
- ┌─────────────────┬──────────────────────────────────────────┐
- │ Acknowledgement │ │
- └─────────────────┴──────────────────────────────────────────┘
-
- I would acknowledge my heartfelt gratitude to the following
- people who had helped me when I started work on my graphical
- library. I have forgotten to acknowledge Mark Morley in my
- previous release of the documents and I apologise for my neglect.
-
-
- Goran Devic, who had really helped me a great deal in my
- "quest"!
-
- Smith Grant, who developed the excellent VGA trainers that
- started me on the idea of developing my own library.
-
- Joshua Hightower, who mailed me a lot of information on
- VGA/MCGA programing techniques.
-
- Mark Morley, who has contributed his codes for the VGL20
- library to the internet.
-
- Tim Kientzle, who helped me with the ellipse routine and
- graciously allowed me to incorporate his ellipse routine in
- my library.
-
- Chris/Barry Egerter, for allowing me to use the WGT sprite
- format in my library.
-
- Others, whom I have neglected to acknowledge in this beta
- document.
-
-
- ┌──────────────┬─────────────────────────────────────────────┐
- │ Introduction │ │
- └──────────────┴─────────────────────────────────────────────┘
-
-
- The mtGraph toolkit is developed around the VGA Mode13h graphic
- mode for the purpose of creating games. It is with great hope
- that this toolkit will eventually become a complete toolkit for
- game development but right now, it can only provide simple
- graphical primitives. If anyone would like to contribute their
- codes or help to develop the library or merely provide
- suggestions, please please let me know!
-
- The mtGraph toolkit supports the Mode 13h video mode on the PC.
- The screen resolution of this is 320x200 pixels where one byte
- represents one pixel. Although the screen resolution may be a bit
- coarse, this mode allows a palette of 256 colours to be displayed
- and it is the most commonly used video mode in games. With this
- in mind, the routines developed will require that the mode 13h
- video mode is set up correctly. No checking is done at this stage
- of the development but this may be corrected in future version.
- The following lists the features of this toolkit.
-
-
-
- ┌───────────┬────────────────────────────────────────────────┐
- │ Features: │ │
- └───────────┴────────────────────────────────────────────────┘
- o Routines for entering and exiting Mode 13h video mode.
-
- o Function to set a clip region.
-
- o Palette routines to load and save table of palette to the
- harddisk, change the VGA palette, fade in and fade out the
- VGA palette with user-defined delay.
-
- o Simple mouse handler with an option to change the cursor.
-
- o Pixel plotting routines. Supports clipping.
-
- o Line routines: horizontal, vertical and bresemham. Supports
- clipping.
-
- o Rectangle routines: outline and filled. Supports clipping.
-
- o Circle and ellipse: outline and filled. Supports clipping.
- I would like to thank Tim Kientzle for use of his ellipse
- algorithm.
-
- o Setting up virtual screens: These are the most essential
- routines if you are looking for smooth, flicker-free
- animations. Simple routines are provided for setting up
- several virtual pages, selecting which pages to be the
- active page, copying hidden page to the active page,
- copying page to page, copying partial block to different
- location (may it be on the same page or different page).
-
- o Image block routines: Allows a bitmap to be copied to the
- active page. Several routines are provided: copy without
- clipping, copy transparently without clipping (color 0 not
- drawn) and the other two supports clipping. Further
- enhancement may provide XOR mode.
-
- o Sprite loading routines: routines are provided to allow
- users to allow user-created bitmaps to be loaded and saved.
- Additional routines are provided to allow users to access
- the WGT sprite files and convert them to the mtGraph sprite
- files. These sprite files can then be passed to the image
- block routine to be displayed.
-
- o Font support: Routines are provided to allow different font
- types to be loaded. As the font types are simply bitmap,
- user can easily develop new font type. At the time of
- writing, only one system font type is provided. The text color
- can be modified. An font editor is planned for future release.
-
- o Miscellaneous: routine to wait for vertical retrace, PCX
- loader, keyboard handler.
-
-
- The Borland products ( C++ Version 3.1) were used for developing
- this toolkit. Most of the routines in the toolkit were developed
- in either assembly using 80286 codes or C/C++. The reason 286
- codes were used was to allow users with 286 computers to use the
- toolkit as well. As they were coded using the Borland compiler
- and assembler, other products may not be able to compile the
- codes.
-
-
- Development Base
- ================
- Intel 486 66Mhz
- Borland C++ compiler
- Turbo Assembler
- Memory 8Mb
-
-
- ┌───────────────────────────┬────────────────────────────────┐
- │ Using the mtGraph Library │ │
- └───────────────────────────┴────────────────────────────────┘
-
- First of all, you will have to check out the release version of
- the mtGraph library that you have. Some of the files may not be
- able to compile with an earlier version of the mtGraph library
- as changes are constantly being done to the library. To determine
- what is the current version, either refer to this document or
- observe the release version of the supplied demonstration file
- (mtdemo.exe) and the released date located at the lower right end
- of the information box. For some reason, the release version may
- be the same but there might be some changes (very minor) to the
- libraries, so it is important to check the release date as well
- (*grin* just in case.) If you got an earlier version, you might
- have not be able to compile your programs.
-
-
- To use the mtGraph library, all you need to do is to create a
- project file add the mtlibxx.lib and your program file into the
- project file. It is that simple. Otherwise, you can make use of
- the makefile provided with the examples and modify accordingly.
- If you are using the Borland C IDE, go to the Option menu.
- Select the debugger option and put the program heap size to
- around 200K. Once this is done, merely type alt C-M/alt C-R or
- type MAKE at the C> prompt to create the EXE file. If you are
- using the makefile, make sure that all the include files are in
- the same directory as your development directory. Otherwise,
- modify your makefile or project files accordingly.
-
- Ok .. enough of all the information crap, now let's get on with
- the programming. In the following section, all the functions
- available in the mtGraph toolkit will be listed. Admittedly, it
- is horrible piece of a document but that is the best I can rush
- out. It will be touched up as and when I find the time...:)
-
-
- IMPORTANT ADDITION : If you are using the Borland C IDE, set the
- program heap size to around 200K. This can be found under the
- Option menu in the debugger option. If this is not set, the
- program will not work properly.
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Video Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetVGAMode(void) │
- └────────────────────────────────────────────────────────────┘
- set up the mode 13h video modes
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetTextMode(void) │
- └────────────────────────────────────────────────────────────┘
- exit mode 13h and return to the inital text mode
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetWindow(int x1,int y1,int x2,int y2) │
- └────────────────────────────────────────────────────────────┘
- set up a clip region
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtResetWindow(void) │
- └────────────────────────────────────────────────────────────┘
- reset the clip region to full screen
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtClrScr(int color) │
- └────────────────────────────────────────────────────────────┘
- Depending on the clip region, it will clear the screen
- with the user-defined colour.
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Page Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ block mtAllocPage(int x1,int y1,int x2,int y2) │
- └────────────────────────────────────────────────────────────┘
- set up the virtual screens
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtFreePage(block page)
- │
- └────────────────────────────────────────────────────────────┘
- free the virtual screens
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtSetPage(block page) │
- └────────────────────────────────────────────────────────────┘
- set up the active page
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtFlipPage(block page) │
- └────────────────────────────────────────────────────────────┘
- flip the hidden page to the screen
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtCopyPage(block src,block dest) │
- └────────────────────────────────────────────────────────────┘
- copy an entire source page to a destination page
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtCopyBlk(int x1,int y1,int x2,int y2,int xoff, │
- │ int yoff,block src,block dest) │
- └────────────────────────────────────────────────────────────┘
- copy a rectangle block from the source page to a new
- location in the destination page. The source and
- destination page can be the same.
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtClipBlk(int *x1,int *y1,int *x2,int *y2) │
- └────────────────────────────────────────────────────────────┘
- clip a block with respect to the clip region
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Block Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ WGTSPRITE │
- │ **mtLoadWGT(char *filename,byte palette[]) │
- └────────────────────────────────────────────────────────────┘
- load up the WGT sprite file
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtSaveWGT(char *fontname,WGTSPRITE **sprite) │
- └────────────────────────────────────────────────────────────┘
- save a sprite file under WGT sprite file format
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtFreeWGT(WGTSPRITE **sprite) │
- └────────────────────────────────────────────────────────────┘
- free the sprite blocks
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ SPRITE **mtLoadBlit(char *filename,byte palette[]) │
- └────────────────────────────────────────────────────────────┘
- load up the mtGraph sprite file
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtSaveBlit(char *filename,SPRITE **sprite) │
- └────────────────────────────────────────────────────────────┘
- save a sprite file under mtGraph sprite file format
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtFreeBlit(SPRITE **sprite) │
- └────────────────────────────────────────────────────────────┘
- free the sprite blocks
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtPutSprite(int x,int y,int width,int height, │
- │ byte far *buf) │
- └────────────────────────────────────────────────────────────┘
- display a bitmap. Color 0 is not drawn
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCPutSprite(int x,int y,int width,int height, │
- │ byte far *buf) │
- └────────────────────────────────────────────────────────────┘
- same as above but performs clipping
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtPutBlit(int x,int y,int width,int height, │
- │ byte far *buf) │
- └────────────────────────────────────────────────────────────┘
- display a bitmap but color 1 is copied to the screen
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtRemoveBlit(SPRITE *sprite) │
- └────────────────────────────────────────────────────────────┘
- display a bitmap but color 1 is copied to the screen
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCPutBlit(int x,int y,int width,int height, │
- │ char far *buf) │
- └────────────────────────────────────────────────────────────┘
- same as above but performs clipping
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtRemoveBlit(SPRITE *sprite) │
- └────────────────────────────────────────────────────────────┘
- free the allocated memory for the sprite file
-
-
-
-
-
-
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Pixel Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtPutPixel(int x,int y,int color) │
- └────────────────────────────────────────────────────────────┘
- puts a pixel with user-defined color at x,y
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCPutPixel(int x,int y,int color) │
- └────────────────────────────────────────────────────────────┘
- same as above but performs clipping
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtGetPixel(int x,int y) │
- └────────────────────────────────────────────────────────────┘
- get the color of the pixel at x,y
-
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Line Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtLine(int x1,int y1,int x2,int y2,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a line
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCLine(int x1,int y1,int x2,int y2,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a line but supports clipping
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtHLine(int x1,int x2,int y1,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a horizontal line but does not support clipping.
- Advisable to use mtLine / mtCLine as alternative
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtVLine(int x1,int y1,int y2,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a vertical line but does not support clipping.
- Advisable to use mtLine / mtCLine as alternative
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Rectangle Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtRect(int x1,int y1,int x2,int y2,int color) │
- └────────────────────────────────────────────────────────────┘
- draw an outline of a rectangle
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCRect(int x1,int y1,int x2,int y2,int color) │
- └────────────────────────────────────────────────────────────┘
- same as above but clipped
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtFillRect(int x1,int y1,int x2,int y2,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a filled rectangle
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCFillRect(int x1,int y1,int x2,int y2,int color) │
- └────────────────────────────────────────────────────────────┘
- same as above but clipped
-
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Circle Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCircle(int x,int y,int radius,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a circle at x,y with radius and color
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCCircle(int x,int y,int radius,int color) │
- └────────────────────────────────────────────────────────────┘
- same as above but performs clipping
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtFillCircle(int x,int y,int radius,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a filled circle at x,y with radius and color
-
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCFillCircle(int x,int y,int radius,int color) │
- └────────────────────────────────────────────────────────────┘
- same as above but performs clipping
-
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Ellipse Routine ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtEllipse(int x,int y, int a, int b,int color) │
- └────────────────────────────────────────────────────────────┘
- draw an ellipse at x,y with major axis (a) and minor
- axis (b)
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCEllipse(int x,int y, int a, int b,int color) │
- └────────────────────────────────────────────────────────────┘
- draw an ellipse at x,y with major axis (a) and minor
- axis (b). Supports clipping.
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtFillEllipse(int x,int y, int a, int b,int color) │
- └────────────────────────────────────────────────────────────┘
- draw a filled ellipse at x,y with major axis (a) and
- minor axis (b)
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtCFillEllipse(int x,int y, int a, int b,int color)│
- └────────────────────────────────────────────────────────────┘
- draw a filled ellipse at x,y with major axis (a) and
- minor axis (b). Supports clipping.
-
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Font Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ mtFONT* mtLoadFont(char *fontname) │
- └────────────────────────────────────────────────────────────┘
- load up the font type
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtSaveFont(char *fontname,FONT *font) │
- └────────────────────────────────────────────────────────────┘
- save the user-define font type to the harddisk
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtFreeFont(FONT *font) │
- └────────────────────────────────────────────────────────────┘
- remove the space allocated for the font
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetColor(byte color) │
- └────────────────────────────────────────────────────────────┘
- change the font color
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtPutc(int x,int y,int c,FONT *font) │
- └────────────────────────────────────────────────────────────┘
- display a character at x,y
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtPrintStr(int x,int y,char* str,FONT *font) │
- └────────────────────────────────────────────────────────────┘
- display a string starting at x,y
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Image File Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtLoadPCX(char *filename); │
- └────────────────────────────────────────────────────────────┘
- load up a 320x200 256 colors PCX file
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Mouse Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtInitMouse() │
- └────────────────────────────────────────────────────────────┘
- Determine if mouse driver is present. If yes, reset
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtShowMouse() │
- └────────────────────────────────────────────────────────────┘
- show the cursor
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtHideMouse() │
- └────────────────────────────────────────────────────────────┘
- hide the cursor
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtGetMousePos(int *button,int *x,int *y) │
- └────────────────────────────────────────────────────────────┘
- return the mouse position and the status of the button
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetMousePos(int x,int y) │
- └────────────────────────────────────────────────────────────┘
- set the cursor's position
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtGetMousePress(int button,int *count,int *x,int*y)│
- └────────────────────────────────────────────────────────────┘
- determine the status of the button, the no. of time
- pressed at which location.
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtGetMouseRel(int button,int *count,int *x,int *y) │
- └────────────────────────────────────────────────────────────┘
- determine the status of the button, the no of time
- released at which location
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetMouseWin(int x1,int y1,int x2,int y2) │
- └────────────────────────────────────────────────────────────┘
- set a window boundary for the mouse cursor
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetDefCursor() │
- └────────────────────────────────────────────────────────────┘
- set up the default cursor
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSetCursor(int *array) │
- └────────────────────────────────────────────────────────────┘
- set up a 16x16 array as cursor
-
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Palette Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtSetCol(byte colindex,byte red,byte green, │
- │ byte blue │
- └────────────────────────────────────────────────────────────┘
- set the RGB color at color index.
- ┌────────────────────────────────────────────────────────────┐
- │ int mtGetCol(byte colindex,byte red,byte green, │
- │ byte blue │
- └────────────────────────────────────────────────────────────┘
- get the RGB color at color index.
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtLoadPal(char *filename,byte palette[]) │
- └────────────────────────────────────────────────────────────┘
- load a table of palette from the harddisk
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtSavePal(char *filename,byte palette[]) │
- └────────────────────────────────────────────────────────────┘
- saves a table of palette
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtClearPal(byte palette[]) │
- └────────────────────────────────────────────────────────────┘
- clear a palette table
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtSetPal(byte pal[],byte start,byte end) │
- └────────────────────────────────────────────────────────────┘
- set the palette ranging from start index to the end index.
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtBlackOut(void) │
- └────────────────────────────────────────────────────────────┘
- set the palette to black color.
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtWhiten(void) │
- └────────────────────────────────────────────────────────────┘
- set the palette to 255 color.
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ int mtGetAllPal(byte pal[]) │
- └────────────────────────────────────────────────────────────┘
- to extract the palette from the registers
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtFadeOut(int interval) │
- └────────────────────────────────────────────────────────────┘
- to reduce the video palette to all zero at a certain
- interval
-
-
-
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtFadeIn(byte palette[],byte inc,int interval) │
- └────────────────────────────────────────────────────────────┘
- to increase the video palette from zero to the desired
- palette
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Sound Routines (extremely primitive) ▒
- ▒ ▒
- ▒ (Not particular sure if it work.. didn't test ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtSound(int hertz, int duration) │
- └────────────────────────────────────────────────────────────┘
- to make a sound
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtClick(void) │
- └────────────────────────────────────────────────────────────┘
- to make a clicking sound
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Keyboard Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtKeyInst(void) │
- └────────────────────────────────────────────────────────────┘
- to install the keyboard handler
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtKeyUninst(void) │
- └────────────────────────────────────────────────────────────┘
- to remove the keyboard handler
-
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ Miscellaneous Routines ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌────────────────────────────────────────────────────────────┐
- │ void mtWaitRetrace(void) │
- └────────────────────────────────────────────────────────────┘
- wait for vertical retrace
-
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ▒ ▒
- ▒ References ▒
- ▒ ▒
- ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
-
- ┌───────────────────┬────────────────────────────────────────┐
- │ Assembly Language │ │
- └───────────────────┴────────────────────────────────────────┘
- 1. Auerbach, J. "IBM PC Assembly Language Tutorial", Article,
- Unknown.
-
- 2. "Draeden", "Introduction to Assembler", Game Programming
- Encyclopedia, 1993/94.
-
- 3. Murray III, W.H. and Pappas, C.H. "80386/80286 Assembly
- Language Programming", Intl Edn, McGraw-Hill Inc, 1986.
-
- 4. Swan,T. "Mastering Turbo Assembler", Hayden Books, 1989.
-
-
- ┌──────────┬─────────────────────────────────────────────────┐
- │ Graphics │ │
- └──────────┴─────────────────────────────────────────────────┘
-
- 1. Foley, J.D., Van Dam, A., Feiner, S.K., Hughes, J.F.
- "Computer Graphics : Principles and Practice", 2nd Edn,
- Addison-Wesley, 1991.
-
- 2. Ferraro, R.F. "Programmer's Guide to the EGA and VGA
- cards", 2nd Edn, Addison-Wesley, 1990.
-
- 3. Morley, M. "VGL20", Mode13h library
-
- 4. Smith, G. "VGA Trainers", Tutorials 1 - 11.
-
- 5. Sutty, G. and Blair, S. "Advanced Programmer's Guide to the
- EGA/VGA", Brady Books, 1988.
-
- 6. Wilton, R. "Programmer Guide to PC & PS/2 Video Systems",
- Microsoft Press, 1987.
-
-
- ┌────────┬───────────────────────────────────────────────────┐
- │ Others │ │
- └────────┴───────────────────────────────────────────────────┘
-
- 1. Game Developers' Magazine by Phil Inch.
-
- 2. Game Programming Encyclopedia (PC-GPE) compiled by Mark
- Feldman.
-
- 3. Kientzle, T. Algorithm Alley, "Dr.Dobb's Journal", pg 119-
- ---------------
- 120, Vol. 19, Issue 7, Jul 1994.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-